import { BroadCastCall } from "../../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../../Framework/MQ/MessageBlock";
import { SRaceSkillDrops } from "../../../../../Message/Public/SRaceSkillDrops";
import { SRaceSkillDrop } from "../../../../../Message/Public/SRaceSkillDrop";
import { EUpdateType } from "../../../../../Message/Public/EUpdateType";
import { Cache } from "../../../cache/Cache";
import { NetDispatcher } from "../../../../mvc/core/NetDispatcher";
import { ServerCommand } from "../../../mvc/ServerCommand";
//class RaceCopySkillDropCommand
    
    export  class RaceCopySkillDropCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            var loc3=null;
            var loc1=arg1.messageBase as SRaceSkillDrops;
            var loc2=0;
            while (loc2 < loc1.drops.length) 
            {
                if ((loc3 = loc1.drops[loc2] as SRaceSkillDrop).updateType.value() != EUpdateType._EUpdateTypeDel) 
                {
                    if (loc3.updateType.value() == EUpdateType._EUpdateTypeAdd) 
                    {
                        Cache.instance.copy.raceCopyAddSkill(loc3);
                    }
                }
                else 
                {
                    Cache.instance.copy.raceCopyDelSkill(loc3);
                }
                ++loc2;
            }
            NetDispatcher.dispatchCmd(ServerCommand.RaceCopySkillDrop, loc3);
            return;
        }
    }
